package com.upf1sh.controller;

import com.upf1sh.bean.DCRec;
import com.upf1sh.service.DCRecService;
import com.upf1sh.utils.Result;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/dcRec")
@CrossOrigin
public class DCRecController {
    @Resource
    private DCRecService dcRecService;

    /**
     * UpF1sh
     * 2023/6/7 16:15
     * 插入，历史记录
     *
     * @param dcRec
     */
    @RequestMapping("/insert")
    public Result insert(@RequestBody DCRec dcRec) {
        System.out.println(dcRec);
        dcRecService.insert(dcRec);
        return Result.ok();
    }

    @RequestMapping("/getAllRecords")
    public Result getAllRecords() {
        return Result.ok().data("records", dcRecService.getAllRecords());
    }
}
